property  head, tail, count, ilk

on new me, p_head, p_tail
  me.ilk = #ImmutableList
  if voidP(p_tail) then me.count = 0
  else 
    me.head = p_head
    me.tail = p_tail
    me.count = p_tail.count + 1  
  end if
  return me
end

on ilk me
  return me.ilk
end

on cons me,element
  return me.script.new(element,me)
end

-- To implement lingo list interface

on count me
  return me.count
end

on getAt me,i
  if me.count = 0 then return #indexOutOfRange
  if i = 1 then return me.head
  else return me.tail.getAt(i-1)
end